# Maintainer: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
pkgname=py3-coverage
pkgver=6.5.0
pkgrel=5
pkgdesc="Code coverage measurement for Python"
options="!check" # Requires 'xdist'
url="https://pypi.org/project/coverage"
arch="all"
license="Apache-2.0"
makedepends="python3-dev py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/c/coverage/coverage-$pkgver.tar.gz"
builddir="$srcdir/coverage-$pkgver"

replaces="py-coverage" # Backwards compatibility
provides="py-coverage=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel --wheel-dir .dist --output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
}

sha512sums="
4f2ec0bf69a83471a2b5a73b6a2212372ee6e32ccc4c72e0d33eef915939152f3213ab60e1a22ce2b72791e706c2223b0c81c87b95bbfadd1e828fa1a9fff120  coverage-6.5.0.tar.gz
"
